package com.he.controller;

import com.he.feign.ServiceProviderService;
import com.he.pojo.CommonResult;
import com.he.pojo.User;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class consumerController {
    @Resource
    ServiceProviderService serviceProviderService;
    @GetMapping("/test/{userId}")
    public CommonResult<User> getProviderUser(@PathVariable("userId") Integer userId) {
        User user =new User();
        try {
            user = serviceProviderService.getUser(userId);
        } catch (Exception e) {
            e.printStackTrace();
            return new CommonResult<>(500, "错误", null);
        }
        return new CommonResult<User>(200, "成功", user);
    }
}
